// pages/mine/bankcard/index.js
const service = require('../../../service/other');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    bankList: []
  },

  onShow: function () {
    this.initData()
  },

  initData() {
    let userId = wx.getStorageSync("userInfo").id;
    service.getMyBankList(userId, (res) => {
      if (res.code == '00000') {
        this.setData({
          bankList: res.data
        })
      }
    })
  },

  deleteCard(e) {
    let data = e.currentTarget.dataset.data
    let _this = this
    wx.showModal({
      title: '提示',
      content: '是否确认删除银行卡',
      success(res) {
        if (res.confirm) {
          service.delBankCard(data.cardId, (res) => {
            wx.showToast({
              title: '删除成功',
            })
            _this.initData()
          })
        }
      }
    })
  },



  editBackcard(e) {
    console.log(1111, e)
    wx.navigateTo({
      url: '/pages/mine/bankcard/edit/index',
    })
  }
})